package com.polimi.meteocal.business.entity;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the notification database table.
 * 
 */
@Embeddable
public class NotificationPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="USERS_EMAIL", insertable=false, updatable=false)
	private String usersEmail;

	@Column(name="EVENT_ID", insertable=false, updatable=false)
	private int eventId;

	public NotificationPK() {
	}
	public String getUsersEmail() {
		return this.usersEmail;
	}
	public void setUsersEmail(String usersEmail) {
		this.usersEmail = usersEmail;
	}
	public int getEventId() {
		return this.eventId;
	}
	public void setEventId(int eventId) {
		this.eventId = eventId;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof NotificationPK)) {
			return false;
		}
		NotificationPK castOther = (NotificationPK)other;
		return 
			this.usersEmail.equals(castOther.usersEmail)
			&& (this.eventId == castOther.eventId);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.usersEmail.hashCode();
		hash = hash * prime + this.eventId;
		
		return hash;
	}
}